package com.lwl.multisource;

public class TenantThreadLocal {

	private static InheritableThreadLocal<String> idLocal;

	protected static String defaulTenantId = "test";

	static {
		idLocal = new InheritableThreadLocal<String>();
		idLocal.set(defaulTenantId);
	}

	public static String getId() {
		String id = idLocal.get();
		if (id == null)
			id = defaulTenantId;
		return id;
	}

	public static void setId(String id) {
		idLocal.set(id);
	}

	public static void removeId() {
		idLocal.remove();
	}
}
